<?php

namespace app\app\controller;

use app\app\model\ProjectPaperFileModel;
use app\app\model\ProjectPaperModel;
use app\BaseController;
use app\Request;


class ProjectPaper extends BaseController
{
    public function list()
    {
        $project_id = input('project_id');
        $list['design_photo'] = ProjectPaperModel::field('paper_ml,paper_ml_code')
            ->where('project_id', $project_id)->select();
        $this->success('success', $list);

    }

    public function add(Request $request)
    {
        $data = $request->param();
        $data['create_time'] = date('Y-m-d H:i:s', time());
        ProjectPaperFileModel::create($data);
        $this->success('success');
    }

    public function detail()
    {
        $id = input('paper_id');
        $list = ProjectPaperFileModel::alias('a')
            ->field('a.*,b.file_name,b.file_path')
            ->join('sys_file_info b', 'a.file_id = b.file_id')
            ->where('a.paper_id', $id)->select();
        $this->success('success', $list);
    }


}
